package www.albert.springMybatis.dao.impl;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import www.albert.springMybatis.dao.UserDao;
import www.albert.springMybatis.entry.User;

public class UserDaoImpl extends SqlSessionDaoSupport implements UserDao {

    @Override
    public User findUserById(int id) {
        User user = (User) this.getSqlSession().selectOne("dao.user.selectUserByID", id);
        return user;
    }

    @Override
    public void insertUser(User user) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void deleteUser(int id) {
        int delete = this.getSqlSession().delete("dao.user.deleteUserByID", id);
        System.out.println("删除了 " + delete + " 条数据");
    }
}
